package com.mida.bms.report.api;

import com.mida.bms.report.entity.DocStructDefinitionSpace;
import com.mida.bms.report.vo.DocStructDefinitionSpacePageVo;
import com.mida.bms.report.vo.DocStructDefinitionSpaceVo;
import com.mida.bms.report.vo.PageResultVo;
import com.mida.tool.common.result.ActionResult;
import com.mida.tool.common.result.ListResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.DependsOn;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ：wang xiao le
 * @description：TODO 结构化模板定义空间feign接口
 * @date ：
 */
@DependsOn("loadFromDatabasePropertyConfig")
@FeignClient(name = "docStructDefinitionSpaceApi", url = "bms.report.feign.url")
public interface DocStructDefinitionSpaceApi {


    /**
     * 1、添加定义空间
     *
     * @param docStructDefinitionSpaceVo
     * @return
     */
    @PostMapping(value = "/docStructDefinitionSpace/add",consumes = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    ActionResult add(@RequestBody DocStructDefinitionSpaceVo docStructDefinitionSpaceVo);

    /**
     * 2、更新定义空间
     *
     * @param docStructDefinitionSpaceVo
     * @return
     */
    @PostMapping(value = "/docStructDefinitionSpace/update",consumes = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    ActionResult update(@RequestBody DocStructDefinitionSpaceVo docStructDefinitionSpaceVo);


    /**
     * 3、删除定义空间
     *
     * @param docStructDefinitionSpaceSoid 定义空间soid
     * @return null
     */
    @DeleteMapping("/docStructDefinitionSpace/delete")
    @ResponseBody
    ActionResult delete(@RequestParam(value = "docStructDefinitionSpaceSoid") long docStructDefinitionSpaceSoid);


    /**
     * 5、分页查询定义空间
     *
     * @param vo
     * @return
     */
    @PostMapping(value = "/docStructDefinitionSpace/findPage",consumes = MediaType.APPLICATION_JSON_VALUE,produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    ListResult<PageResultVo<DocStructDefinitionSpaceVo>> findPage(@RequestBody DocStructDefinitionSpacePageVo vo);

    /**
     *6、定义空间名称重复性校验
     */
    @GetMapping(value = "/docStructDefinitionSpace/checkName")
    @ResponseBody
     ActionResult checkName(@RequestParam(value = "name", required = true) String name,
                            @RequestParam(value = "defineSpaceSoid", required = false) Long defineSpaceSoid);


    /**
     *7、更改定义空间状态
     *
     * @param defineSpaceSoid 定义空间soid
     * @param status          状态码
     * @return
     */
    @GetMapping("/docStructDefinitionSpace/updateStatus")
    @ResponseBody
     ActionResult updateStatus(@RequestParam(value = "status", required = true) Long status,
                               @RequestParam(value = "defineSpaceSoid", required = true) Long defineSpaceSoid);


    /**
     * 8、查询所有定义空间
     * @param searchData  搜索关键字
     * @return
     */
    @GetMapping(value = "/docStructDefinitionSpace/findAll",produces = { "application/json;charset=UTF-8" })
    @ResponseBody
    ListResult<List<DocStructDefinitionSpace>> findAll(@RequestParam(value = "searchData", required = false) String searchData,@RequestParam(value = "hospitalSoid") Long hospitalSoid);

    /**
     * 9、根据定义空间soid查询定义空间基本信息
     * @param defineSpaceSoid 定义空间soid
     * @return
     */
    @GetMapping("/docStructDefinitionSpace/selectByDefineSpaceSoid")
    @ResponseBody
    ListResult<DocStructDefinitionSpaceVo> selectByDefineSpaceSoid(@RequestParam(value = "defineSpaceSoid") long defineSpaceSoid);
}
